<?php

class Application_Form_Uzytkownik extends Zend_Form {

    public function init() {
        $passwordConfirmation = new My_Plugin_PasswordConfirmation();

        $this->addElement('text', 'email', array(
            'label' => 'Adres e-mail:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StringToLower',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'EmailAddress',
                'NotEmpty',
            )
        ));

        $this->addElement('password', 'password', array(
            'label' => 'Hasło:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                $passwordConfirmation,
                'NotEmpty',
                array('StringLength', false, array(8, 100)),
            )
        ));

        $this->addElement('password', 'password_confirm', array(
            'label' => 'Powtórz hasło:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                $passwordConfirmation,
                'NotEmpty',
                array('StringLength', false, array(8, 100)),
            )
        ));

        $this->addElement('text', 'imie', array(
            'label' => 'Imię:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'Alnum',
                array('StringLength', false, array(2, 100)),
            )
        ));

        $this->addElement('text', 'nazwisko', array(
            'label' => 'Nazwisko:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'Alnum',
                array('StringLength', false, array(2, 100)),
            )
        ));

        $this->addElement('text', 'firma', array(
            'label' => 'Firma:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'NotEmpty',
                array('StringLength', false, array(2, 100)),
            )
        ));

        $this->addElement('hidden', 'id');

        $this->addElement('submit', 'zapisz');
    }

}
